package br.ufpe.cin.msc.jrsj2.recommender.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public abstract class ClientHash {

	public static String getClientHashString(String clientId) {
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			md.update(clientId.getBytes());
			BigInteger hashInt = new BigInteger(1, md.digest());

			return String.format("%1$032X", hashInt);
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
			return null;
		}
	}
}
